From: Tim Starling Date: Sat, 1 Nov 2008 21:38:46 +0000 (+0000) Subject: Convert from old DiffHistoryBlob format. Untested, committing for test by Jelte. X-Git-Tag: 1.31.0-rc.0~44478 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=79478bb117dbb7471ef3a537cdbc2d0519598434;p=lhc%2Fweb%2Fwiklou.git Convert from old DiffHistoryBlob format. Untested, committing for test by Jelte. --- diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 323d10745b..dda5078107 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -456,7 +456,7 @@ class DiffHistoryBlob implements HistoryBlob { } } if ( $header['csize'] != strlen( $base ) ) { - wfDebug( __METHOD__. ": incorrect base length {$header['csize']} -> {strlen($base)}\n" ); + wfDebug( __METHOD__. ": incorrect base length\n" ); return false; } @@ -547,14 +547,23 @@ class DiffHistoryBlob implements HistoryBlob { if ( isset( $info['default'] ) ) { $this->mDefaultKey = $info['default']; } - $map = explode( ',', $info['map'] ); - $cur = 0; - $this->mDiffMap = array(); - foreach ( $map as $i ) { - $cur += $i; - $this->mDiffMap[] = $cur; - } $this->mDiffs = $info['diffs']; + if ( isset( $info['base'] ) ) { + // Old format + $this->mDiffMap = range( 0, count( $this->mDiffs ) - 1 ); + array_unshift( $this->mDiffs, + pack( 'VVCV', 0, 0, self::XDL_BDOP_INSB, strlen( $info['base'] ) ) . + $info['base'] ); + } else { + // New format + $map = explode( ',', $info['map'] ); + $cur = 0; + $this->mDiffMap = array(); + foreach ( $map as $i ) { + $cur += $i; + $this->mDiffMap[] = $cur; + } + } $this->uncompress(); }